package com.ecco.persistent;

import java.util.Collection;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "objects", catalog = "ecco_demo", uniqueConstraints = {})

public class Objects implements java.io.Serializable {
	
	/**
	 * 
	 */
	private static final long serialVersionUID = -2028528263346010405L;

	// Fields
	private Integer ob_id;
	private String ob_name;
	private Collection<AccObCol> aocRecords;
	
	// Constructors
	public Objects() { 	}
	
	/** minimal constructor */
	public Objects (Integer ob_id) {
		this.setOb_id(ob_id);
	}
	
	/** full constructor */
	public Objects(Integer ob_id, String ob_name) {
		this.setOb_id(ob_id);
		this.setOb_name(ob_name);
	}
	
	//	 Property accessors
	@Id
	@GeneratedValue
	@Column(name = "OB_ID")
	public Integer getOb_id() {
		return ob_id;
	}

	public void setOb_id(Integer ob_id) {
		this.ob_id = ob_id;
	}

	@Column(name = "OB_NAME", unique = false, nullable = true, insertable = true, updatable = true, length = 30)
	public String getOb_name() {
		return ob_name;
	}

	public void setOb_name(String ob_name) {
		this.ob_name = ob_name;
	}
	
	@OneToMany(mappedBy="objects",cascade = CascadeType.ALL, fetch = FetchType.LAZY)
	public Collection<AccObCol> getAocRecords(){
	return aocRecords;
	}
	
	public void setAocRecords(Collection<AccObCol> aocRecords) {
		this.aocRecords = aocRecords;
	}
	
}
